home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / gcc / ixemul_src.lha / ixemul-41.0 / man / cat2 / getrlimit.0 < prev    next >
Text File  |  1992-08-10  |  5KB  |  133 lines

  1.  
  2. GETRLIMIT(2)               UNIX Programmer's Manual               GETRLIMIT(2)
  3.  
  4. NNAAMMEE
  5.      ggeettrrlliimmiitt, sseettrrlliimmiitt - control maximum system resource consumption
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  9.      ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
  10.  
  11.      _i_n_t
  12.      ggeettrrlliimmiitt(_i_n_t _r_e_s_o_u_r_c_e, _s_t_r_u_c_t _r_l_i_m_i_t _*_r_l_p)
  13.  
  14.      _i_n_t
  15.      sseettrrlliimmiitt(_i_n_t _r_e_s_o_u_r_c_e, _s_t_r_u_c_t _r_l_i_m_i_t _*_r_l_p)
  16.  
  17. DDEESSCCRRIIPPTTIIOONN
  18.      Limits on the consumption of system resources by the current process and
  19.      each process it creates may be obtained with the ggeettrrlliimmiitt() call, and
  20.      set with the sseettrrlliimmiitt() call.
  21.  
  22.      The _r_e_s_o_u_r_c_e parameter is one of the following:
  23.  
  24.      RLIMIT_CPU      the maximum amount of cpu time (in seconds) to be used by
  25.                      each process.
  26.  
  27.      RLIMIT_FSIZE    the largest size, in bytes, of any single file that may
  28.                      be created.
  29.  
  30.      RLIMIT_DATA     the maximum size, in bytes, of the data segment for a
  31.                      process; this defines how far a program may extend its
  32.                      break with the sbrk(2) system call.
  33.  
  34.      RLIMIT_STACK    the maximum size, in bytes, of the stack segment for a
  35.                      process; this defines how far a program's stack segment
  36.                      may be extended.  Stack extension is performed automati­
  37.                      cally by the system.
  38.  
  39.      RLIMIT_CORE     the largest size, in bytes, of a core file that may be
  40.                      created.
  41.  
  42.      RLIMIT_RSS      the maximum size, in bytes, to which a process's resident
  43.                      set size may grow.  This imposes a limit on the amount of
  44.                      physical memory to be given to a process; if memory is
  45.                      tight, the system will prefer to take memory from pro­
  46.                      cesses that are exceeding their declared resident set
  47.                      size.
  48.  
  49.      A resource limit is specified as a soft limit and a hard limit.  When a
  50.      soft limit is exceeded a process may receive a signal (for example, if
  51.      the cpu time or file size is exceeded), but it will be allowed to contin­
  52.      ue execution until it reaches the hard limit (or modifies its resource
  53.      limit).  The _r_l_i_m_i_t structure is used to specify the hard and soft limits
  54.      on a resource,
  55.  
  56.            struct rlimit {
  57.                    int     rlim_cur;       /* current (soft) limit */
  58.                    int     rlim_max;       /* hard limit */
  59.            };
  60.  
  61.      Only the super­user may raise the maximum limits.  Other users may only
  62.      alter _r_l_i_m___c_u_r within the range from 0 to _r_l_i_m___m_a_x or (irreversibly) low­
  63.      er _r_l_i_m___m_a_x.
  64.  
  65.  
  66.      An ``infinite'' value for a limit is defined as RLIM_INFINITY
  67.      (0x7fffffff).
  68.  
  69.      Because this information is stored in the per­process information, this
  70.      system call must be executed directly by the shell if it is to affect all
  71.      future processes created by the shell; lliimmiitt is thus a built­in command
  72.      to csh(1).
  73.  
  74.      The system refuses to extend the data or stack space when the limits
  75.      would be exceeded in the normal way: a break call fails if the data space
  76.      limit is reached.  When the stack limit is reached, the process receives
  77.      a segmentation fault (SIGSEGV); if this signal is not caught by a handler
  78.      using the signal stack, this signal will kill the process.
  79.  
  80.      A file I/O operation that would create a file larger that the process'
  81.      soft limit will cause the write to fail and a signal SIGXFSZ to be gener­
  82.      ated; this normally terminates the process, but may be caught.  When the
  83.      soft cpu time limit is exceeded, a signal SIGXCPU is sent to the offend­
  84.      ing process.
  85.  
  86. RREETTUURRNN VVAALLUUEESS
  87.      A 0 return value indicates that the call succeeded, changing or returning
  88.      the resource limit.   A return value of ­1 indicates that an error oc­
  89.      curred, and an error code is stored in the global location _e_r_r_n_o.
  90.  
  91. EERRRROORRSS
  92.      GGeettrrlliimmiitt() and sseettrrlliimmiitt() will fail if:
  93.  
  94.      [EFAULT]      The address specified for _r_l_p is invalid.
  95.  
  96.      [EPERM]       The limit specified to sseettrrlliimmiitt() would have raised the
  97.                    maximum limit value, and the caller is not the super­user.
  98.  
  99. SSEEEE AALLSSOO
  100.      csh(1),  quota(2),  sigvec(2),  sigstack(2)
  101.  
  102. BBUUGGSS
  103.      There should be lliimmiitt and uunnlliimmiitt commands in sh(1) as well as in csh.
  104.  
  105. HHIISSTTOORRYY
  106.      The ggeettrrlliimmiitt function call appeared in 4.2BSD.
  107.  
  108. 4th Berkeley Distribution       March 10, 1991                               2
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.